//
//  LoginVC.m
//  LoginTest
//
//  Created by 战立军 on 2017/2/20.
//  Copyright © 2017年 战立军. All rights reserved.
//

#import "LoginVC.h"
#import "RegistVC.h"
#import "ForgetVC.h"
#import "LoginView.h"
#import "PhoneLoginVC.h"

@interface LoginVC ()<LoginViewDelegate>
{
    LoginView *_loginView;
    
}
@end

@implementation LoginVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (!_loginView) {
        _loginView = [[LoginView alloc] initWithFrame:self.view.frame];
        _loginView.delegate = self;
    }
    
    self.view = _loginView;
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark LoginViewDelegat

-(void)loginViewLoginButtonPressWithUsername:(NSString *)username UserPwd:(NSString *)userpwd
{
    if ([UIUTils isBlankString:username]) {
        
        [UIUTils showReminderMBProgressHUDWithTitle:@"用户名不能为空" view:self.view];
        return;
    }
    else if([UIUTils isBlankString:userpwd])
    {
        [UIUTils showReminderMBProgressHUDWithTitle:@"密码不能为空" view:self.view];
        return;
    }
    NSLog(@"登录 %@%@",username,userpwd);
}

-(void)loginViewRegistButtonPress
{
    NSLog(@"注册");
    RegistVC *registVC = [[RegistVC alloc] init];
    [self presentViewController:registVC animated:YES completion:nil];
}

-(void)loginViewforgetpwdButtonPress
{
    NSLog(@"忘记密码");
    
    ForgetVC *forgetVC = [[ForgetVC alloc] init];
    [self presentViewController:[[UINavigationController alloc] initWithRootViewController:forgetVC] animated:YES completion:nil];
}

-(void)loginViewsmsButtonPress
{
    NSLog(@"d短信登录");
    
    PhoneLoginVC  *phoneLoginVC = [[PhoneLoginVC alloc] init];
    [self presentViewController:[[UINavigationController alloc] initWithRootViewController:phoneLoginVC] animated:YES completion:nil];
}

@end
